struct Solution {}

fn main() {}

impl Solution {
    pub fn number_of_lines(widths: Vec<i32>, s: String) -> Vec<i32> {
        let mut line_cnt = 1;
        let mut sum = 0;
        for ch in s.as_bytes() {
            let index = Self::get_index(ch, &widths);
            if sum + widths[index] > 100 {
                line_cnt += 1;
                sum = widths[index];
                continue;
            }
            sum += widths[index];
        }
        vec![line_cnt, sum]
    }

    pub fn get_index(c: &u8, width: &Vec<i32>) -> usize {
        let index = c - ('a' as u8);
        return index as usize;
    }
}